/**
 * Created by Administrator on 2017/12/18 0018.
 */
define(['jquery','bbcare','scprit/patientsQuestionnaire/vm/common.js'],function($,$bb,$common){
    var servers = {};
    var URL = $bb.baseUrl("followup");
    // console.log(URL);
    /*
    * 获取验证码：
    * */
    servers.getCode = function(params,callback,otherParams){
        $common.ajax({
            url: URL + "followup/webapi/service/patient/sendRegMsgAppUser",
            data: JSON.stringify({
                data: {
                    "channel":"BBCARE-APP",
                    "phoneNo":params.phone,
                    "smsType":"01"
                }
            }),
            success: function (data) {
                callback(data,otherParams)
            }
        });
    };
    /*
    * 校验验证码：
    * */
    servers.checkVerifyCode = function(params,callback,otherParams){
        $common.ajax({
            url: URL + "followup/webapi/service/patient/checkVerifyCode",
            data: JSON.stringify({
                data: {
                    "channel":"BBCARE-APP",
                    "phoneNo":params.phone,
                    "smsType":"01",
                    "type":"1",
                    "verifyCode":params.code
                }
            }),
            success: function (data) {
               callback(data,otherParams)
            }
        });
    };
    /*
    * 是否建档：
    * */
    servers.isBookbuilding = function(params,callback,otherParams){
        $common.ajax({
            url: URL + "followup/webapi/service/queryUserMassage",
            data: JSON.stringify({
                data: {
                	"patientName":params.username,
                    "channel":"BBCARE-APP",
                    "phoneNo":params.phone,
                    "followQueueId":params.queueId
                }
            }),
            success: function (data) {
                callback(data,otherParams);
            }
        });
    };
    /*
    * 去建档：
    * */
    servers.toBookbuilding = function(params,callback,otherParams){
        $common.ajax({
            url: URL + "followup/webapi/service/register/CreateUser",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                callback(data,otherParams)
            }
        });
    };
    /*
    *  获取建档问卷：
     */
    servers.getQuestion = function(params,callback,otherParams){
        $common.ajax({
            url:URL + "followup/webapi/service/getPatientAddQuestion",
            data: JSON.stringify({
                data: {
                    "channel": "BBCARE-APP",
                    "queueId":params.queueId
                }
            }),
            success: function (data) {
                callback(data,otherParams)
            }
        });
    };
    return servers;
});
